package algotithm.leetcode.bit.test1342;

/**
 * @author zhouyanxiang
 * @Date 2021-02-2021/2/4-10:58
 * @Title 1342. 将数字变成 0 的操作次数
 * @URL https://leetcode-cn.com/problems/number-of-steps-to-reduce-a-number-to-zero/
 */
class Solution {

    public static void main(String[] args) {
        Solution solution = new Solution();
        int num = 14;
        int number = solution.numberOfSteps(num);
        System.out.println(num);
    }

    public int numberOfSteps (int num) {
        return num > 1 ? 1 + (num % 2) + numberOfSteps(num >> 1) : num;
    }
}